package com.jwsoft.manager.core.gateway.controller;

import com.jwsoft.manager.core.integration.EduLotteryAnnouncementIntegration;
import com.jwsoft.manager.common.vo.eduLotteryAnnouncement.EduLotteryAnnouncementVO;
import com.jwsoft.manager.common.vo.eduLotteryAnnouncement.EduLotteryAnnouncementKeyVO;
import com.jwsoft.manager.common.vo.eduLotteryAnnouncement.EduLotteryAnnouncementQueryVO;
import com.github.pagehelper.PageInfo;
import com.bifang.engine.assistant.core.domain.AppResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import com.bifang.engine.protect.core.annotation.Idempotent;
import org.springframework.validation.annotation.Validated;
import com.bifang.assistant.common.constants.Validators;

/**
 * 金华摇号结果公示网关
 *
 * @author wangt
 * @since 2024-06-16
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "金华摇号结果公示", description = "金华摇号结果公示")
public class EduLotteryAnnouncementController {

    @Autowired
    public EduLotteryAnnouncementIntegration eduLotteryAnnouncementIntegration;

    @Operation(summary = "金华摇号结果公示分页查询",description = "金华摇号结果公示分页查询")
    @PostMapping(value = "/eduLotteryAnnouncement0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduLotteryAnnouncementVO>> getList(@RequestBody @Validated EduLotteryAnnouncementQueryVO vo) {
        return AppResponse.successData(eduLotteryAnnouncementIntegration.getList(vo));
    }

    @Operation(summary = "金华摇号结果公示根据主键查询详情",description = "金华摇号结果公示根据主键查询详情")
    @PostMapping(value = "/eduLotteryAnnouncement0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduLotteryAnnouncementVO> getById(@RequestBody @Validated EduLotteryAnnouncementKeyVO vo) {
        return AppResponse.successData(eduLotteryAnnouncementIntegration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "金华摇号结果公示新增",description = "金华摇号结果公示新增")
    @PostMapping(value = "/eduLotteryAnnouncement0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduLotteryAnnouncementVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduLotteryAnnouncementVO vo) {
        return AppResponse.successData(eduLotteryAnnouncementIntegration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "金华摇号结果公示修改",description = "金华摇号结果公示修改")
    @PostMapping(value = "/eduLotteryAnnouncement0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduLotteryAnnouncementVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduLotteryAnnouncementVO vo) {
        return AppResponse.successData(eduLotteryAnnouncementIntegration.edit(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "金华摇号结果公示删除",description = "金华摇号结果公示删除")
    @PostMapping(value = "/eduLotteryAnnouncement0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduLotteryAnnouncementKeyVO vo) {
        eduLotteryAnnouncementIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }
}
